#pragma once

class RtspMedia
	:public VideoEncDataObserver,
	public AudioEncDataObserver,
	public VideoCaptureObserver,
	public AudioCaptureObserver
{
public:
	RtspMedia();
	~RtspMedia();
	void StartCapture();
	void StopCapture();
	void StartPush();
	void StopPush();
private:	
	virtual void onVideoCaptureData(void* data, int len)override;
	virtual void onAudioCaptureData(void* data, int len)override;
	virtual void onVideoEncodeData(void* data, long long len, int dts, int pts);
	virtual void onAudioEncodeData(void* data, long long len);
private:
	mk_media _media;
	const int video_codec_id;
	const int audio_codec_id;
	mk_track _video_track;
	mk_track _audio_track;
	int _src_w=0;
	int _src_h=0;
	int _src_fps = 0;
	int _channels = 1;
	int _sampels = 48000;
	std::unique_ptr<DesktopCapture> _desktop_video = nullptr;
	std::unique_ptr<EncodeBase> _video_encoder = nullptr;
	std::unique_ptr<EncodeBase> _audio_encoder = nullptr;
	std::unique_ptr<char[]> audio_buffer;
	int audio_samples = 0;
	int audio_frame_size = 0;
	bool _isStartPush = false;
	long long _start_time;
};

